|
1
|
|
|
/** |
|
2
|
|
|
* NOTICE OF LICENSE |
|
3
|
|
|
* |
|
4
|
|
|
* Copyright (c) 2019 B2BinPay |
|
5
|
|
|
* |
|
6
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
7
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
|
8
|
|
|
* in the Software without restriction, including without limitation the rights |
|
9
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
|
11
|
|
|
* furnished to do so, subject to the following conditions: |
|
12
|
|
|
* |
|
13
|
|
|
* The above copyright notice and this permission notice shall be included in all |
|
14
|
|
|
* copies or substantial portions of the Software. |
|
15
|
|
|
* |
|
16
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
17
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
18
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
19
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
20
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
21
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
22
|
|
|
* SOFTWARE. |
|
23
|
|
|
* |
|
24
|
|
|
* @author B2BINPAY <[email protected]> |
|
25
|
|
|
* @copyright 2019 B2BinPay |
|
26
|
|
|
* @license https://github.com/b2binpay/prestashop/blob/master/LICENSE The MIT License (MIT) |
|
27
|
|
|
*/ |
|
28
|
|
|
|
|
29
|
|
|
function b2binpayWalletsSave() { |
|
30
|
|
|
var wallets = $('table#b2binpayWallets tbody tr').get().map(function (row) { |
|
31
|
|
|
return { |
|
32
|
|
|
'id': $(row).find('input[name^="b2binpay-wallet-id-"]').val(), |
|
33
|
|
|
'currency': $(row).find('input[name^="b2binpay-wallet-currency-"]').val(), |
|
34
|
|
|
'alpha': $(row).find('input[name^="b2binpay-wallet-alpha-"]').val(), |
|
35
|
|
|
'iso': $(row).find('input[name^="b2binpay-wallet-iso-"]').val() |
|
36
|
|
|
}; |
|
37
|
|
|
}); |
|
38
|
|
|
|
|
39
|
|
|
return JSON.stringify(wallets); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
$(document).ready(function () { |
|
43
|
|
|
var counter = 0; |
|
44
|
|
|
|
|
45
|
|
|
$("#b2binpayWalletAdd").on("click", function () { |
|
46
|
|
|
var newRow = $("<tr>"); |
|
47
|
|
|
var cols = ""; |
|
48
|
|
|
|
|
49
|
|
|
cols += '<td><input type="text" class="form-control" name="b2binpay-wallet-id-' + counter + '"/></td>'; |
|
50
|
|
|
cols += '<td><input type="text" class="form-control" name="b2binpay-wallet-currency-' + counter + '"/></td>'; |
|
51
|
|
|
cols += '<td></td><td></td>'; |
|
52
|
|
|
|
|
53
|
|
|
cols += '<td><input type="button" class="b2binpayWalletDel btn btn-md btn-danger " value="Delete"></td>'; |
|
54
|
|
|
newRow.append(cols); |
|
55
|
|
|
$("table#b2binpayWallets").append(newRow); |
|
56
|
|
|
counter++; |
|
57
|
|
|
}); |
|
58
|
|
|
|
|
59
|
|
|
$("table#b2binpayWallets").on("click", ".b2binpayWalletDel", function () { |
|
60
|
|
|
$(this).closest("tr").remove(); |
|
61
|
|
|
counter -= 1 |
|
62
|
|
|
}); |
|
63
|
|
|
|
|
64
|
|
|
$("button[name='submitB2binpayModule']").on("click", function () { |
|
65
|
|
|
$("#B2BINPAY_WALLETS").val(b2binpayWalletsSave()); |
|
66
|
|
|
}); |
|
67
|
|
|
}); |
|
68
|
|
|
|